package controllers

import (
	"yeoman/models"
)

// Operations about Article
type ArticletypeController struct {
	commonController
}

// @Title 获取分类
// @Description 获取分类
// @Success 200 {object} models.ArticleType
// @Failure 403 id is empty
// @router /index [get]
func (this *ArticletypeController) Index() {
	this.AllowCross() //允许跨域
	artType := models.GetArtTypeList()
	this.Data["json"] = &artType
	this.ServeJSON()
	return
}

// @Title 获取分类
// @Description 获取分类
// @Success 200 {object} models.ArticleType
// @Failure 403 not allow
// @router /typelist [get]
func (this *ArticletypeController) TypeList() {
	this.AllowCross() //允许跨域
	artType := models.GetArtTypeList()
	this.Data["json"] = &artType
	this.ServeJSON()
	return
}
